<%--
  Created by IntelliJ IDEA.
  User: corcutt
  Date: Mar 22, 2009
  Time: 4:54:33 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Edit Position</title></head>
<script LANGUAGE="JavaScript">
    <!--
    // Nannette Thacker http://www.shiningstar.net
    function confirmSubmit()
    {
        var agree = confirm("Are you sure you wish to remove the volunteer from the position?");
        if (agree)
            return true;
        else
            return false;
    }
    // -->
</script>
<body>
<%@ include file="header.jspf" %>
<h3>Edit Your Event Position Information:</h3>
<%@ include file="eventDetailTable.jspf" %>

<form:form modelAttribute="position">
    <table width="100%">
        <tr>
            <td colspan="2">Edit Your Event Position Information</td>
        </tr>
        <tr>
            <td>Position Name:</td>
            <td>
                <form:input path="name" autocomplete="false"/> <!-- email parameter mapped somewhere.. ? -->
                <form:errors path="name" cssStyle="color: red"/>
            </td>
        </tr>
        <tr>
            <td>Position Description:</td>
            <td>
                <form:input path="description" autocomplete="false"/>
                <form:errors path="description" cssStyle="color: red"/>
            </td>
        </tr>
        <tr>
            <td>Position Location:</td>
            <td>
                <form:input path="location" autocomplete="false"/>
            </td>
        </tr>
        <tr>
            <td>Position Start Date and Time (yyyy-mm-dd hh:mm:ss):</td>
            <td>
                <form:input path="startDateAndTime" autocomplete="false"/>
                <form:errors path="startDateAndTime" cssStyle="color: red"/>
            </td>
        </tr>
        <tr>
            <td>Position End Date and Time (yyyy-mm-dd hh:mm:ss):</td>
            <td>
                <form:input path="endDateAndTime" autocomplete="false"/>
                <form:errors path="endDateAndTime" cssStyle="color: red"/>
            </td>
        </tr>
        <tr>
            <td>Number of Volunteers needed for position:</td>
            <td>
                <form:input path="numberOfVolunteers" autocomplete="false"/>
                <form:errors path="numberOfVolunteers" cssStyle="color: red"/>
            </td>
        </tr>

        <form:hidden path="id"/>
        <tr>
            <td colspan="2" style="text-align:center"><input type="submit" value="Update"></td>
        </tr>
    </table>
</form:form>

<table border="1" width="100%">
    <tr>
        <td colspan="4">Volunteers for Position: ${position.name} </td>
    </tr>
    <tr>
        <td BGCOLOR="limegreen"><strong>First Name</strong></td>
        <td BGCOLOR="limegreen"><strong>Last Name</strong></td>
        <td BGCOLOR="limegreen"><strong>E-mail</strong></td>
        <td BGCOLOR="limegreen"></td>
    </tr>
    <c:forEach var="volunteer" items="${position.volunteers}">
        <tr>
            <td>${volunteer.firstName}</td>
            <td>${volunteer.lastName}</td>
            <td>${volunteer.email}</td>
            <td valign="top">
                <form method="GET" action="<c:url value="removeVolunteer"/>" name="removeVolunteer">
                    <input type="hidden" name="eventID" value="${event.id}"/>
                    <input type="hidden" name="positionID" value="${position.id}"/>
                    <input type="hidden" name="volunteerID" value="${volunteer.id}"/>

                    <p class="submit">
                        <input type="submit" value="Remove Volunteer From Position" onClick="return confirmSubmit()"/>
                    </p>
                </form>
            </td>

        </tr>
    </c:forEach>
</table>

<%@ include file="footer.jspf" %>

</body>
</html>